};
gboolean
-ot_admin_builtin_cleanup (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GError **error)
+ot_admin_builtin_cleanup (int argc, char **argv, GFile *sysroot, GCancellable *cancellable, GError **error)
{
GOptionContext *context;
gboolean ret = FALSE;
- __attribute__((unused)) GCancellable *cancellable = NULL;
context = g_option_context_new ("Delete untagged deployments and repository objects");
if (!g_option_context_parse (context, &argc, &argv, error))
goto out;
- if (!ot_admin_cleanup (admin_opts->sysroot, cancellable, error))
+ if (!ot_admin_cleanup (sysroot, cancellable, error))
goto out;
ret = TRUE;
};
gboolean
-ot_admin_builtin_deploy (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GError **error)
+ot_admin_builtin_deploy (int argc, char **argv, GFile *sysroot, GCancellable *cancellable, GError **error)
{
gboolean ret = FALSE;
- __attribute__((unused)) GCancellable *cancellable = NULL;
const char *refspec;
GOptionContext *context;
- GFile *sysroot = admin_opts->sysroot;
GKeyFile *origin = NULL;
int current_bootversion;
int new_bootversion;
};
gboolean
-ot_admin_builtin_diff (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GError **error)
+ot_admin_builtin_diff (int argc, char **argv, GFile *sysroot, GCancellable *cancellable, GError **error)
{
GOptionContext *context;
gboolean ret = FALSE;
gs_unref_ptrarray GPtrArray *deployments = NULL;
gs_unref_object GFile *orig_etc_path = NULL;
gs_unref_object GFile *new_etc_path = NULL;
- __attribute__((unused)) GCancellable *cancellable = NULL;
int bootversion;
context = g_option_context_new ("Diff current /etc configuration versus default");
if (!g_option_context_parse (context, &argc, &argv, error))
goto out;
- repo_path = g_file_resolve_relative_path (admin_opts->sysroot, "ostree/repo");
+ repo_path = g_file_resolve_relative_path (sysroot, "ostree/repo");
- if (!ot_admin_list_deployments (admin_opts->sysroot, &bootversion, &deployments,
+ if (!ot_admin_list_deployments (sysroot, &bootversion, &deployments,
cancellable, error))
{
g_prefix_error (error, "While listing deployments: ");
goto out;
}
- if (!ot_admin_require_deployment_or_osname (admin_opts->sysroot, deployments,
+ if (!ot_admin_require_deployment_or_osname (sysroot, deployments,
opt_osname, &deployment,
cancellable, error))
goto out;
goto out;
}
- deployment_dir = ot_admin_get_deployment_directory (admin_opts->sysroot, deployment);
+ deployment_dir = ot_admin_get_deployment_directory (sysroot, deployment);
orig_etc_path = g_file_resolve_relative_path (deployment_dir, "usr/etc");
new_etc_path = g_file_resolve_relative_path (deployment_dir, "etc");
};
gboolean
-ot_admin_builtin_init_fs (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GError **error)
+ot_admin_builtin_init_fs (int argc, char **argv, GFile *sysroot, GCancellable *cancellable, GError **error)
{
GOptionContext *context;
gboolean ret = FALSE;
gs_unref_object GFile *child = NULL;
guint i;
const char *normal_toplevels[] = {"boot", "dev", "home", "proc", "run", "sys"};
- GCancellable *cancellable = NULL;
context = g_option_context_new ("PATH - Initialize a root filesystem");
g_option_context_add_main_entries (context, options, NULL);
};
gboolean
-ot_admin_builtin_os_init (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GError **error)
+ot_admin_builtin_os_init (int argc, char **argv, GFile *sysroot, GCancellable *cancellable, GError **error)
{
GOptionContext *context;
gboolean ret = FALSE;
const char *osname = NULL;
gs_unref_object GFile *deploy_dir = NULL;
gs_unref_object GFile *dir = NULL;
- __attribute__((unused)) GCancellable *cancellable = NULL;
context = g_option_context_new ("OSNAME - Initialize empty state for given operating system");
g_option_context_add_main_entries (context, options, NULL);
if (!g_option_context_parse (context, &argc, &argv, error))
goto out;
- if (!ot_admin_ensure_initialized (admin_opts->sysroot, cancellable, error))
+ if (!ot_admin_ensure_initialized (sysroot, cancellable, error))
goto out;
if (argc < 2)
osname = argv[1];
- deploy_dir = ot_gfile_get_child_build_path (admin_opts->sysroot, "ostree", "deploy", osname, NULL);
+ deploy_dir = ot_gfile_get_child_build_path (sysroot, "ostree", "deploy", osname, NULL);
/* Ensure core subdirectories of /var exist, since we need them for
* dracut generation, and the host will want them too. Note that at
};
gboolean
-ot_admin_builtin_status (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GError **error)
+ot_admin_builtin_status (int argc, char **argv, GFile *sysroot, GCancellable *cancellable, GError **error)
{
GOptionContext *context;
gboolean ret = FALSE;
int bootversion;
gs_unref_object OtDeployment *booted_deployment = NULL;
gs_unref_ptrarray GPtrArray *deployments = NULL;
- __attribute__((unused)) GCancellable *cancellable = NULL;
guint i;
context = g_option_context_new ("List deployments");
if (!g_option_context_parse (context, &argc, &argv, error))
goto out;
- if (!ot_admin_list_deployments (admin_opts->sysroot, &bootversion, &deployments,
+ if (!ot_admin_list_deployments (sysroot, &bootversion, &deployments,
cancellable, error))
{
g_prefix_error (error, "While listing deployments: ");
goto out;
}
- if (!ot_admin_find_booted_deployment (admin_opts->sysroot, deployments,
+ if (!ot_admin_find_booted_deployment (sysroot, deployments,
&booted_deployment,
cancellable, error))
goto out;
{
int subbootversion;
- if (!ot_admin_read_current_subbootversion (admin_opts->sysroot, bootversion,
+ if (!ot_admin_read_current_subbootversion (sysroot, bootversion,
&subbootversion,
cancellable, error))
goto out;
};
gboolean
-ot_admin_builtin_undeploy (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GError **error)
+ot_admin_builtin_undeploy (int argc, char **argv, GFile *sysroot, GCancellable *cancellable, GError **error)
{
gboolean ret = FALSE;
- __attribute__((unused)) GCancellable *cancellable = NULL;
- GFile *sysroot = admin_opts->sysroot;
GOptionContext *context;
const char *deploy_index_str;
int deploy_index;
};
gboolean
-ot_admin_builtin_upgrade (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GError **error)
+ot_admin_builtin_upgrade (int argc, char **argv, GFile *sysroot, GCancellable *cancellable, GError **error)
{
gboolean ret = FALSE;
- __attribute__((unused)) GCancellable *cancellable = NULL;
GOptionContext *context;
- GFile *sysroot = admin_opts->sysroot;
gs_free char *booted_osname = NULL;
gs_unref_object OstreeRepo *repo = NULL;
gs_unref_object GFile *repo_path = NULL;
if (!g_option_context_parse (context, &argc, &argv, error))
goto out;
- if (!ot_admin_list_deployments (admin_opts->sysroot, ¤t_bootversion,
+ if (!ot_admin_list_deployments (sysroot, ¤t_bootversion,
¤t_deployments,
cancellable, error))
{
goto out;
}
- if (!ot_admin_require_deployment_or_osname (admin_opts->sysroot, current_deployments,
+ if (!ot_admin_require_deployment_or_osname (sysroot, current_deployments,
opt_osname,
&booted_deployment,
cancellable, error))
merge_deployment = ot_admin_get_merge_deployment (current_deployments, opt_osname,
booted_deployment);
- deployment_path = ot_admin_get_deployment_directory (admin_opts->sysroot, merge_deployment);
+ deployment_path = ot_admin_get_deployment_directory (sysroot, merge_deployment);
deployment_origin_path = ot_admin_get_deployment_origin_path (deployment_path);
- repo_path = g_file_resolve_relative_path (admin_opts->sysroot, "ostree/repo");
+ repo_path = g_file_resolve_relative_path (sysroot, "ostree/repo");
repo = ostree_repo_new (repo_path);
if (!ostree_repo_check (repo, error))
goto out;
else
{
gs_unref_object GFile *real_sysroot = g_file_new_for_path ("/");
- if (!ot_admin_deploy (admin_opts->sysroot,
+ if (!ot_admin_deploy (sysroot,
current_bootversion, current_deployments,
opt_osname, new_revision, origin,
NULL, FALSE,
G_BEGIN_DECLS
-typedef struct {
- GFile *sysroot;
-} OtAdminBuiltinOpts;
-
-gboolean ot_admin_builtin_os_init (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GError **error);
-gboolean ot_admin_builtin_install (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GError **error);
-gboolean ot_admin_builtin_init_fs (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GError **error);
-gboolean ot_admin_builtin_undeploy (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GError **error);
-gboolean ot_admin_builtin_deploy (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GError **error);
-gboolean ot_admin_builtin_cleanup (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GError **error);
-gboolean ot_admin_builtin_status (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GError **error);
-gboolean ot_admin_builtin_diff (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GError **error);
-gboolean ot_admin_builtin_upgrade (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GError **error);
+gboolean ot_admin_builtin_os_init (int argc, char **argv, GFile *sysroot, GCancellable *cancellable, GError **error);
+gboolean ot_admin_builtin_install (int argc, char **argv, GFile *sysroot, GCancellable *cancellable, GError **error);
+gboolean ot_admin_builtin_init_fs (int argc, char **argv, GFile *sysroot, GCancellable *cancellable, GError **error);
+gboolean ot_admin_builtin_undeploy (int argc, char **argv, GFile *sysroot, GCancellable *cancellable, GError **error);
+gboolean ot_admin_builtin_deploy (int argc, char **argv, GFile *sysroot, GCancellable *cancellable, GError **error);
+gboolean ot_admin_builtin_cleanup (int argc, char **argv, GFile *sysroot, GCancellable *cancellable, GError **error);
+gboolean ot_admin_builtin_status (int argc, char **argv, GFile *sysroot, GCancellable *cancellable, GError **error);
+gboolean ot_admin_builtin_diff (int argc, char **argv, GFile *sysroot, GCancellable *cancellable, GError **error);
+gboolean ot_admin_builtin_upgrade (int argc, char **argv, GFile *sysroot, GCancellable *cancellable, GError **error);
G_END_DECLS
typedef struct {
const char *name;
- gboolean (*fn) (int argc, char **argv, OtAdminBuiltinOpts *admin_opts, GError **error);
+ gboolean (*fn) (int argc, char **argv, GFile *sysroot, GCancellable *cancellable, GError **error);
} OstreeAdminCommand;
static OstreeAdminCommand admin_subcommands[] = {
const char *subcommand_name;
OstreeAdminCommand *subcommand;
int subcmd_argc;
- OtAdminBuiltinOpts admin_opts;
+ gs_unref_object GFile *sysroot = NULL;
char **subcmd_argv = NULL;
if (argc > 1 && g_str_has_prefix (argv[1], "--sysroot="))
ostree_prep_builtin_argv (subcommand_name, argc-2, argv+2, &subcmd_argc, &subcmd_argv);
- admin_opts.sysroot = g_file_new_for_path (opt_sysroot);
- if (!subcommand->fn (subcmd_argc, subcmd_argv, &admin_opts, error))
+ sysroot = g_file_new_for_path (opt_sysroot);
+ if (!subcommand->fn (subcmd_argc, subcmd_argv, sysroot, cancellable, error))
goto out;
ret = TRUE;